<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <div v-for="(user,index) in userList">
            {{user.name}}-->{{user.age}}-->{{index}}
        </div>
    </div>
    <script src="vue.min.js"></script>
    <script src="axios.min.js"></script>
    <script>
        new Vue({
            el: '#app',
            data: {
                userList:{}
            },
            created() {//在页面渲染之前执行
                this.getList()
            },
            methods: {
                getList(){
                    axios.get("user.json")
                    .then(res=>{
                        console.log(res)
                        this.userList = res.data.data.userList
                    })
                    .catch(err=>{
                        console.log(err)
                    })
                }
            },
            mounted() {//在页面渲染之后执行
                
            },
        })
    </script>
</body>

</html>